<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Exception;
use Illuminate\Support\Facades\Cache;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;


    public function CheckDeveloperAccessToken($inputs)
    {
        if (!isset($inputs['token']) || strlen($inputs['token']) <= 10) {
            throw new Exception("access_token is error");
        } 

        if (!Cache::has('DEV_AccToken_' . $inputs['token'])) {
            throw new Exception("access_token is error");
        }

        return Cache::get('DEV_AccToken_' . $inputs['token']);
    }
}
